package com.by.facade.enums.course;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2025/2/25 15:30
 */
@Getter
@AllArgsConstructor
public enum CourseFolderTypeEnum {

    FORMAL_COURSE(CourseFolderTypeEnum.FORMAL_COURSE_CODE, "正式课"),
    GUIDE_COURSE(CourseFolderTypeEnum.GUIDE_COURSE_CODE, "先导课"),
    ;
    private final Integer type;
    private final String desc;
    private static final Map<Integer, CourseFolderTypeEnum> MAP;
    static {
        MAP = Stream.of(CourseFolderTypeEnum.values()).collect(Collectors.toMap(CourseFolderTypeEnum::getType, Function.identity()));
    }

    public static CourseFolderTypeEnum resolveByType(Integer type){
        return MAP.get(type);
    }

    public static final int FORMAL_COURSE_CODE = 1;
    public static final int GUIDE_COURSE_CODE = 2;

}
